import service from "../utils/request"

// 添加用户
export const addRequest = (data: any) => {
  return service.post("/admin/user/add", data)
}
// 删除用户
export const delRequest = (id: any) => {
  return service.delete(`/admin/user/${id}`)
}
// 编辑用户
export const editRequest = (data: any) => {
  return service.put("/admin/user/update", data)
}
// 分页查询用户
export const pageRequest = (query: any) => {
  return service.get("/admin/user/list", {
    params: query,
  })
}
// 查询用户详情
export const getDetail = (id: number) => {
  return service.get(`/admin/user/${id}`)
}
// 重置密码
export const resetPassword = (data: any) => {
  return service.post(
    `/admin/user/reset-password/${data.id}?newPassword=${data.password}`
  )
}
// 获取所有部门
export const getAllDep = () => {
  return service.get("/admin/user/departments")
}
